package com.jelly.mina.simpleness;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;


/**
 *  IoHandlerAdapter
 * @author Jelly
 *
 */
public class SamplMinaServerHandler extends IoHandlerAdapter{
	
	private int count=0;
	

	@Override
	public void sessionOpened(IoSession session) throws Exception {
		System.out.println("incomming client:"+session.getRemoteAddress());
	}
	

	@Override
	public void sessionClosed(IoSession session) throws Exception {
		System.out.println("one Client Disconnect");
	}
	

	@Override
	public void messageReceived(IoSession session, Object message)
			throws Exception {
		String s =message.toString();
		Thread.sleep(1000);
		System.out.println(s);
		session.write(s+count);
		count++;
	}
}
